﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MethodWorx.CMS.TemplateLanguage
{
    public static class IParserExtensions
    {
        public static T PopToFirst<T>(this Stack<object> src)
            where T : class
        {
            //
            //  look up the stack for the first page
            T found = null;
            while (src.Count > 0)
            {
                found = src.Pop() as T;
                if (found != null)
                    break;
            }

            return found;
        }
    }
}
